﻿using System;
using System.Collections.Generic;
using System.IO; //added
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms; //added
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Microsoft.Windows.Controls.Ribbon;

namespace WeatherView
{
    /// <summary>
    /// Interaction logic for Workspace.xaml
    /// 
    /// Workspace is the main window used iin Weather View
    /// </summary>
    public partial class Workspace
    {
        public Workspace()
        {
            InitializeComponent();
        }

        
        private void OpenAboutBox(object sender, ExecutedRoutedEventArgs e) // Opens the about box
        {
            AboutBox AboutWindow = new AboutBox();
            AboutWindow.ShowDialog();              // prevents the user interacting with any other application window until this one is closed
        }

        private void VisitDocumentation(object sender, ExecutedRoutedEventArgs e) // Shows project documentation
        {
            WebPresenter WebViewer = new WebPresenter();  // presents project documentation using web presenter
            WebViewer.WebViewer.Source = new Uri("http://code.google.com/p/weatherview/w/list");
            WebViewer.Title = "Project Documentation - Weatherview";
            WebViewer.ShowDialog();
        }

        private void VisitQuickStart(object sender, ExecutedRoutedEventArgs e) // shows project quickstart
        {
            DocumentPresenter QuickStartViewer = new DocumentPresenter(); // presents quickstart guide using document presenter

            // an xaml document is found and opened
            FileStream xamlDocument = new FileStream(System.Environment.CurrentDirectory + "/Documents/QuickStart.xaml", FileMode.Open, FileAccess.Read);
            // the document is read and parsed...
            FlowDocument content = XamlReader.Load(xamlDocument) as FlowDocument;

            // ...and then fed into the document viewer
            QuickStartViewer.DocumentViewer.Document = content;
            // source document is closed.
            xamlDocument.Close();

            // viewer is opened
            QuickStartViewer.Title = "Quickstart guide - Weatherview";
            QuickStartViewer.ShowDialog();
        }

        private void VisitIssueList(object sender, ExecutedRoutedEventArgs e) // shows project issues
        {
            WebPresenter WebViewer = new WebPresenter();  // presents project documentation using web presenter
            WebViewer.WebViewer.Source = new Uri("http://code.google.com/p/weatherview/issues/list");
            WebViewer.ShowDialog();
        }

        private void VisitIssueCreate(object sender, ExecutedRoutedEventArgs e) // shows issue creation page
        {
            WebPresenter WebViewer = new WebPresenter();  // presents project documentation using web presenter
            WebViewer.WebViewer.Source = new Uri("http://code.google.com/p/weatherview/issues/entry");
            WebViewer.ShowDialog();
        }

        private void VisitSource(object sender, ExecutedRoutedEventArgs e) //shows source code viewer
        {
            WebPresenter WebViewer = new WebPresenter();  // presents project documentation using web presenter
            WebViewer.WebViewer.Source = new Uri("http://code.google.com/p/weatherview/source/browse/#svn/trunk");
            WebViewer.ShowDialog();
        }

        private void VisitSourceCheckout(object sender, ExecutedRoutedEventArgs e) // gives checkout instructions
        {
            WebPresenter WebViewer = new WebPresenter();  // presents project documentation using web presenter
            WebViewer.WebViewer.Source = new Uri("http://code.google.com/p/weatherview/source/checkout");
            WebViewer.ShowDialog();
        }
    }
}
